package com.thyme.content.resttemplate;

import com.alibaba.cloud.sentinel.rest.SentinelClientHttpResponse;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;

/**
 * @author thyme
 * @ClassName BlockHandler
 * @Description TODO
 * @Date 2019/11/13 11:50
 */
@Slf4j
public class FallBackHandler {

    public static SentinelClientHttpResponse fallBackHandle(HttpRequest request,
                                                             byte[] body,
                                                            ClientHttpRequestExecution execution,
                                                            BlockException ex){
        log.info("fallBack Handler");
        return new SentinelClientHttpResponse("异常出现");
    }
}
